//
//  LaunchDyManager.m
//  JFTwxsd
//
//  Created by Peter on 2019/3/14.
//  Copyright © 2019 junfeiweiyejiaoyujituan. All rights reserved.
//

#import "LaunchDyManager.h"
#import "XHLaunchAd.h"

@interface LaunchDyManager ()<XHLaunchAdDelegate>

@end

@implementation LaunchDyManager

+ (void)load {
//    [self shareManager];
}

+ (LaunchDyManager *)shareManager {
    static LaunchDyManager *instance = nil;
    static dispatch_once_t oneToken;
    dispatch_once(&oneToken,^{
        instance = [[LaunchDyManager alloc] init];
    });
    return instance;
}

- (instancetype)init {
    self = [super init];
    if (self) {
        [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidFinishLaunchingNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
            [self setupXHLaunchAd];
        }];
    }
    return self;
}

- (void)setupXHLaunchAd {
    [self example02];
}

- (void)example02 {
    [XHLaunchAd setLaunchSourceType:SourceTypeLaunchImage];
    XHLaunchImageAdConfiguration *imageAdconfiguration = [XHLaunchImageAdConfiguration new];
    imageAdconfiguration.duration = 5;
    imageAdconfiguration.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height * 0.8);
    imageAdconfiguration.imageNameOrURLString = @"启动页750.gif";
    imageAdconfiguration.GIFImageCycleOnce = NO;
    imageAdconfiguration.contentMode = UIViewContentModeScaleAspectFit;
//    imageAdconfiguration.openModel = @"http://www.it7090.com";
    //广告显示完成动画
    imageAdconfiguration.showFinishAnimate =ShowFinishAnimateFlipFromLeft;
    //广告显示完成动画时间
    imageAdconfiguration.showFinishAnimateTime = 0.8;
    //跳过按钮类型
    imageAdconfiguration.skipButtonType = SkipTypeNone;
    //后台返回时,是否显示广告
    imageAdconfiguration.showEnterForeground = NO;
    //设置要添加的子视图(可选)
    //imageAdconfiguration.subViews = [self launchAdSubViews];
    //显示开屏广告
    [XHLaunchAd imageAdWithImageAdConfiguration:imageAdconfiguration delegate:self];
    
}

@end
